package common;

import java.util.Collections;

import javax.cache.Cache;
import javax.cache.CacheException;
import javax.cache.CacheFactory;
import javax.cache.CacheManager;

public class CacheSingleton {
	private static volatile Cache cache = null;
	public synchronized static Cache getCache() throws CacheException{
		if(cache == null){ 
		    CacheFactory cacheFactory = CacheManager.getInstance().getCacheFactory();
            cache = cacheFactory.createCache(Collections.emptyMap());
        }
		return cache;
	}
}
